package com.woniuxy.intellihome.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Random;

public class UtilsTools {
    //获取当前时间
    public static String getTimeNow() {
        SimpleDateFormat sdf = new SimpleDateFormat();// 格式化时间
        sdf.applyPattern("yyyy-MM-dd HH:mm:ss");// a为am/pm的标记
        Date date = new Date();// 获取当前时间

        return sdf.format(date);
    }

    //生成订单编号
    public static String getOrderNum() {
        SimpleDateFormat sdf = new SimpleDateFormat();// 格式化时间
        sdf.applyPattern("yyyyMMddHHmmss");// a为am/pm的标记
        Date date = new Date();
        Random ran = new Random();

        return "WN"+sdf.format(date)+(ran.nextInt(9000) + 1000);
    }
}
